// router.js
import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);
const home = [
    { path: '/', redirect: '/home' },
    {
        path: '/home',
        name: 'home',
        redirect: '/home/star',
        component: resolve => require(['@/views/home/index'], resolve),
        children: [
            {
                path: '/home/star',
                name: 'star',
                component: resolve => require(['@/views/star/index'], resolve)
            },
            {
                path: '/home/fans',
                name: 'fans',
                redirect: '/home/fans/addfans',
                component: resolve => require(['@/views/fans/index'], resolve),
                children: [
                    {
                        path: '/home/fans/addfans',
                        name: 'addfans',
                        component: resolve => require(['@/views/fans/addfans'], resolve),
                    }, {
                        path: '/home/fans/comments',
                        name: 'comments',
                        component: resolve => require(['@/views/fans/comments'], resolve),
                    }, {
                        path: '/home/fans/interactive',
                        name: 'interactive',
                        component: resolve => require(['@/views/fans/interactive'], resolve),
                    }
                ]
            }
        ]
    },
    // {
    //     path: '/query',
    //     component: require('./Components/Query.vue')
    // }
];
// 全部路由
const routes = [
    ...home,
];

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
});

export default router;